#ifndef LCDFUNCTION_H
#define LCDFUNCTION_H

#include "common.h"

/*****************************
	Define Constant
*****************************/

#define RS		PA7
#define RW		PA6
#define E		PA5
#define DB		PORTF


/******************************
	Inline Function
******************************/
#define SetBit(reg,bit)		(reg |=  (1<<(bit)))
#define ClearBit(reg,bit)	(reg &= ~(1<<(bit)))

void E_pulse(void);//when MPU read or write data, E-pulse must be executed.
void InstructionMode(void);
void ClearDisp(void);
void ReturnHome(void);
void EntryModeSet(int add, int shiftReg);
void DispOnOff(int disp, int cursor, int blink); // period of blink : 0.4s
void CursorDispShift(int shiftCursor, int rightLeft);
void FunctionSet(int dataLength, int numberOfLine, int fontType);





/*****************************
	Initialization Function
*****************************/
void InitLCD(void);


/*****************************
	Function
*****************************/
void SetLCDAddress(unsigned char mode);
void WriteChar(char ch);
void WriteStr(char* str);
int BusyFlag(void);

#endif
